<?php

use yii\db\Schema;
use yii\db\Migration;

class m160119_023218_add_app_categories extends Migration
{
    public function up()
    {
        $this->addColumn('{{%mobile_app_category}}', 'category_id', 'int(11) not null comment "ssp 上的 app category id" after ad_network_id');
        $dir = dirname(__FILE__);
        $sql = file_get_contents($dir.'/vam_mobile_app_category.sql');
        $this->execute($sql);
    }

    public function down()
    {
        $this->dropColumn('{{%mobile_app_category}}', 'category_id');
        return $this->execute('truncate table {{%mobile_app_category}}');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
